package com.iotp.service.disease_trait;

import com.iotp.dao.disease_trait.DiseaseTraitMapper;
import com.iotp.entity.disease_trait.DiseaseTrait;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("diseaseTraitService")
public class DiseaseTraitServiceImpl implements DiseaseTraitService {
    @Autowired
    private DiseaseTraitMapper diseaseTraitMapper;
    @Override
    public Long add(DiseaseTrait diseaseTrait) {
        this.diseaseTraitMapper.insert(diseaseTrait);
        return diseaseTrait.getId();
    }

    @Override
    public void update(DiseaseTrait diseaseTrait) {
        this.diseaseTraitMapper.updateByPrimaryKeySelective(diseaseTrait);
    }

    @Override
    public void delete(Long id) {
        this.diseaseTraitMapper.deleteByPrimaryKey(id);
    }

    @Override
    public DiseaseTrait queryById(Long id) {
        return this.diseaseTraitMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<DiseaseTrait> queryList(DiseaseTrait diseaseTrait) {
        return this.diseaseTraitMapper.selectByCondition(diseaseTrait);
    }
}
